{% extends 'template.html' %}
{% load staticfiles %}


{% block content %}
    <div id="page-wrapper" xmlns="http://www.w3.org/1999/html">
        <div class="row">
            <div class="app-title">
                <div>
                    <h3><i class="fa fa-user"></i> {{ username }} - 员工离职</h3>
                    <span class="text-muted text-danger">
                        <p><h5><strong>勾选资产并选择存放位置，提交后将对资产进行批量回收，设置用户为离职状态并移至离职接收部</strong></h5></p>
                    </span>
                </div>
            </div>
        </div>
        {% if user_assets %}
            <div class="row">
                <div class="col-lg-12">
                    <form method="POST" action="{% url 'user_desert' user_id %}" onsubmit="return submit_sure()">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <table width="100%" class="table table-striped table-bordered table-hover"
                                       id="mytable">
                                    <thead>
                                    <tr>
                                        <th class="center sorting_disabled">
                                            <label class="user-desert-rel">
                                                <input id='chb-all' type="checkbox"/>
                                            </label>
                                        </th>
                                        <th style="display: none;">id</th>
                                        <th>资产编号</th>
                                        <th>资产名称</th>
                                        <th>回收保留位置</th>
                                        <th>仓库区域</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for assets in user_assets %}
                                        <tr>
                                            <td class="center sorting_disabled">
                                                <label class="user-desert-rel">
                                                    <input id='chb-one' name="check{{ forloop }}"
                                                           value="{{ assets.id }}"
                                                           type="checkbox"/>
                                                </label>
                                            </td>
                                            <td style="display: none">{{ assets.id }}</td>
                                            <td>{{ assets.assets_number }}</td>
                                            <td>{{ assets.name }}</td>
                                            <td>
                                                <select class="form-control" id="pos_Select2"
                                                        name="recover_position">
                                                    <option value="0" disabled>选择回收后保留位置</option>
                                                    {% for pos in position %}
                                                        {% if pos.name == '露乐大厦9F' %}
                                                            <option value="{{ assets.id }}-{{ pos.id }}"
                                                                    selected>{{ pos.name }}</option>
                                                        {% else %}
                                                            <option value="{{ assets.id }}-{{ pos.id }}">{{ pos.name }}</option>
                                                        {% endif %}
                                                    {% endfor %}
                                                </select>
                                            </td>
                                            <td>
                                                <select class="form-control warehousing_region" id="warehousing_region_Select2"
                                                        name="recover_warehousing_region">
                                                    <option value="0" disabled selected>选择回收后的仓库位置</option>
                                                    {% for wr in warehousing_region %}
                                                        <option value="{{ assets.id }}-{{ wr.id }}">{{ wr.name }}</option>
                                                    {% endfor %}
                                                </select>
                                            </td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div>
                            <button id="bt-create" class="btn btn-success" type="submit" name="assets_print"><i
                                    class="fa fa-fw fa-lg fa-print"></i>生成打印单
                            </button>&nbsp;&nbsp;&nbsp;
                            <button id="bt-recover" class="btn btn-primary" type="submit" name="assets_recover"><i
                                    class="fa fa-fw fa-lg fa-check-circle"></i>提交回收 并 进入下一步
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        {% else %}
            <div class="row">
                <br/>
                <p class="text-danger">该员工没有遗留资产或资产已被回收</p>
                <button class="btn btn-primary" onclick="get_user_clean_page({{ user_id }})">
                    <i class="fa fa-fw fa-lg fa-check-circle"></i>进入清理权限页面
                </button>
                <a class="btn btn-default" href="/users/organization/">返回</a>
            </div>
        {% endif %}
    </div>

{% endblock %}


{% block bodyjs %}

    <!-- Recover Alarm -->
    <script src="/static/js/user_desert_recover.js?v=20191211001"></script>

{% endblock %}


{% block css %}

    <!-- DataTables CSS -->
    <link href="{% static 'css/dataTables.bootstrap.css' %}" rel="stylesheet">
    <!-- DataTables Responsive CSS -->
    <link href="{% static 'css/dataTables.responsive.css' %}" rel="stylesheet">

{% endblock %}